package com.tpc.yaoxpt.job;



import com.tpc.yaoxpt.schedule.PurOrderScheduleService;
import javafx.concurrent.ScheduledService;
import javafx.util.Duration;

import java.util.concurrent.Executors;

public class PurOrderJob {
    ScheduledService<Void> purOrderSchedule = null;

    public void execScheduledService(){
        PurOrderScheduleService purOrderScheduleService = new PurOrderScheduleService();
        purOrderScheduleService.setExecutor(Executors.newFixedThreadPool(1));
        purOrderScheduleService.setDelay(Duration.millis(1000));
        purOrderScheduleService.setPeriod(Duration.millis(60000));
        purOrderScheduleService.start();
        purOrderSchedule = purOrderScheduleService;
    }

    public void stopScheduledService(){
        purOrderSchedule.cancel();
    }
}
